<table class="table table-hover">
    <tr>
        <th>ID</th>
        <th>用户ID</th>
        <th>用户姓名</th>
        <th>提现金额(元)</th>
        <th>申请时间</th>
        <th>联系电话</th>
        <th>支付宝账户</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <?php if($data):?>
        <?php foreach($data as $k => $v):?>
            <tr>
                <td><?php echo $v['id']?></td>
                <td><?php echo $v['uid']?></td>
                <td><?php echo $v['name']?></td>
                <td>&yen;<?php echo sprintf("%.2f", ($v['money'] / 100))?></td>
                <td><?php echo $v['create_time']?></td>
                <td><?php echo $v['mobile']?></td>
                <td><?php echo $v['alipay_account']?></td>
                <td>

                    <?php

                        $_status = [

                            1 => '<span class="orange">申请中</span>',
                            2 => '<span class="green">申请成功</span>',
                            3 => '<span class="red">申请被拒绝</span>',

                        ];

                        echo $_status[$v['status']];

                    ?>

                </td>
                <td data-id="<?php echo $v['id']?>" data-mobile="<?php echo $v['mobile']?>" data-uid="<?php echo $v['uid']?>">
                    <?php if($v['status'] == 1):?>
                        <a href="javascript:;" class="btn btn-xs btn-success pass">申请通过</a>
                        <a href="javascript:;" class="btn btn-xs btn-danger refuse">拒绝申请</a>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>
    <?php else:?>
        <tr>
            <td colspan="9" style="text-align: center;">没有找到符合条件的数据!</td>
        </tr>
    <?php endif;?>
</table>
<div role="group" data-total="<?php echo $total?>" data-page="<?php echo $page?>" data-nums="<?php echo $nums?>" data-src="<?php echo U('Admin/Finance/Withdrawals/lists');?>"  class="btn-group" id="_pages"></div>
<script>
    ;(function($){
        var options = {

            status: '<?php echo $status?>',

        }
        Admin.pages(options);

        //申请通过
        $('.pass').click(function(){

            var _this   = $(this);
            var id      = _this.parent().data('id');
            var mobile  = _this.parent().data('mobile');
            var uid     = _this.parent().data('uid');

            layer.msg('确认已经给该会员打款了吗？', {
                time: 0 //不自动关闭
                ,btn: ['确认', '关闭']
                ,yes: function(index){
                    layer.close(index);

                    layer.load();
                    $.post("<?php echo U('Admin/Finance/Withdrawals/pass')?>",{'id':id,'mobile':mobile,'uid':uid},function(result){

                        layer.closeAll();
                        if(result.code == 200){

                            var data = options;
                            data.page = "<?php echo $page?>";
                            showMessage(result.msg,result.code,"<?php echo U('Admin/Finance/Withdrawals/lists')?>",data,2000);

                        } else {

                            showMessage(result.msg,result.code,'','',2000);

                        }

                    });


                }
            });
        });

        $('.refuse').click(function(){
            var _this   = $(this);
            var id      = _this.parent().data('id');
            var mobile  = _this.parent().data('mobile');
            var uid     = _this.parent().data('uid');
            layer.prompt({title: '请输入拒绝理由', formType: 2}, function(text){

                layer.load();
                $.post("<?php echo U('Admin/Finance/Withdrawals/refuse')?>",{'id':id,'mobile':mobile,'uid':uid,'message':text},function(result){

                    layer.closeAll();
                    if(result.code == 200){

                        var data = options;
                        data.page = "<?php echo $page?>";
                        showMessage(result.msg,result.code,"<?php echo U('Admin/Finance/Withdrawals/lists')?>",data,2000);

                    } else {

                        showMessage(result.msg,result.code,'','',2000);

                    }

                });


            });


        });

    })($);
</script>